package com.heo.protocol.packet;

import org.apache.log4j.Logger;
import com.heo.util.ByteHelper;

/**
 * 服务器主动下发，给设备发重启指令
 * 
 * @author chichi
 */
public class RebootDeviceReq extends BasePacket
{
  private int BODY_LENGTH = 0;// 包体长0
  private static final String PACKET_NAME = "[重启设备请求包]";

  private static Logger log = Logger.getLogger(RebootDeviceReq.class);

  /**
   * 通过网络传过来的流构建对象
   * 
   * @param totalLength
   * @param commandId
   * @param sequenceId
   * @param body
   * @throws Exception
   */
  public RebootDeviceReq(String logHeader, SocketPacket packet) throws Exception
  {
    super.copyPacket(logHeader, PACKET_NAME, packet);
    makeBody();
  }

  @Override
  public int getTotalLength()
  {
    return super.HEAD_LENGTH;
  }

  public RebootDeviceReq(int sequenceId) throws Exception
  {
    super(PACKET_NAME);
    super.sequenceId = sequenceId;
    super.totalLength = (short) (HEAD_LENGTH);
    super.commandId = DeviceCommand.REBOOT_DEVICE_REQ;
    super.sendCount = 1;
  }

  @Override
  public byte[] getPacketBody()
  {
    return ByteHelper.margeByte(null, null, null, null, null, null, null, null, null, null);
  }

  @Override
  public void makeBody() throws Exception
  {
    log.debug(super.logHeader + super.packetName + "数据包解析成功。");
  }

  public static void main(String[] args)
  {

  }

}
